<!--{include(pe_tpl('header.html'));}-->
<div class="huiyuan_content">
	<!--{include(pe_tpl('user_menu.html'));}-->
	<div class="fr huiyuan_main">
		<div class="hy_tt">
			<!--{foreach($ini['quanlog_state'] as $k=>$v):}-->
			<a href="user.php?mod=quan&state={$k}" <!--{if($_g_state==$k):}-->class="sel"<!--{endif;}-->>{$v}（{$tongji[$k]}）<i></i></a>
			<!--{endforeach;}-->
			<a href="javascript:duihuan_open();" class="fabu_btn">券码兑换</a>
		</div>
		<div class="hy_tablelist">
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<th>优惠券名称</th>
				<th width="100">面值</th>
				<th width="100">使用条件</th>
				<th width="100">限定商品</th>
				<th width="200">有效日期</th>
				<th width="80">状态</td>
			</tr>
			<!--{foreach($list as $v):}-->
			<tr>
				<td class="aleft"><a href="{pe_url('quan-'.$v['quan_id'])}" title="{$v['quan_name']}" target="_blank" class="cblue">{$v['quan_name']}</a></td>
				<td><span class="corg">¥{$v['quan_money']}</span></td>
				<td>满{$v['quan_limit']}元</td>
				<td>{$v['product_id']?'部分商品':'无'}</td>
				<td>{$v['quan_sdate']} 至 {$v['quan_edate']}</td>
				<td>
					<!--{if($v['quanlog_state']==0):}-->
					<span class="tag_green">未使用</span>				
					<!--{elseif($v['quanlog_state']==1):}-->
					<span class="tag_gray">已使用</span>					
					<!--{elseif($v['quanlog_state']==2):}-->
					<s class="tag_gray" style="color:#bbb">已过期</s>
					<!--{endif;}-->
				</td>
			</tr>
			<!--{endforeach;}-->
			</table>
		</div>
		<div class="fenye mat10">{$db->page->html}</div>
	</div>
	<div class="clear"></div>
</div>
<script type="text/html" id="duihuan_html">
<form method="post" id="form">
<div class="quan_box" style="text-align:center">
	<input type="text" name="quan_code" value="" class="inputall input200" placeholder="请输入优惠口令" />
	<div class="quan_dh">
		<input type="hidden" name="pesubmit" />
		<input type="button" value="兑换券码" onclick="duihuan_btn()" />
	</div>
</div>
</form>
</script>
<script type="text/javascript">
function duihuan_open() {
	layer.open({
		type: 1,
		title: '兑换优惠券',
		area: ['350px', '220px'],
		fixed: false,
		shadeClose: true,
		shade: 0.5,
		content: $("#duihuan_html").html()
	});
}
//兑换优惠券
function duihuan_btn() {
	pe_get("user.php?mod=quan&act=duihuan&value="+$(":input[name='quan_code']").val(), function(json){
		if (json.code == 1) {
			pe_open('reload', 1000);
		}
	});
}
</script>
<!--{include(pe_tpl('footer.html'));}-->